Summary
At-least-once delivery may deliver duplicates but avoids message loss. Exactly-once is difficult and usually means exactly-once processing within specific system boundaries.
Interview Points
- At-most-once: possible loss, no duplicates.
- At-least-once: no loss if acknowledged correctly, possible duplicates.
- Exactly-once requires coordination, transactions, idempotency, or broker support.
- Most practical systems use at-least-once plus idempotent consumers.
- Define what exactly-once means end to end.
2-3 Minute Interview Script
“At-least-once delivery means a message will be delivered one or more times, so consumers must handle duplicates. Exactly-once is much harder because distributed systems have retries, crashes, and uncertain acknowledgements.
In practice, many reliable systems choose at-least-once delivery and make consumers idempotent. That means if the same event is processed twice, the final state is still correct.
Some platforms offer exactly-once semantics within a bounded scope, such as a stream processor writing transactionally to a supported sink. But I would be careful claiming true end-to-end exactly-once across arbitrary services.
Interview answer: at-least-once plus idempotency is the common production design; exactly-once needs clear boundaries and strong coordination.”
Follow-Ups
- How do you make consumers idempotent?
- What can go wrong with acknowledgements?